﻿@{
    ViewData["Title"] = "User Profile fetched from MS Graph";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<br />
<br />
<h1>Signed-in user's Profile</h1>

<table class="table table-striped table-condensed" style="font-family: monospace" border="1">
    <thead>
        <tr>
            <th>
                Profile picture
            </th>
            <th>
                @{
                    if (ViewData["photo"] != null)
                    {
                        <img style="margin: 5px 0; width: 150px" src="data:image/jpeg;base64, @ViewData["photo"]" />
                    }
                    else
                    {
                        <p>No Pic available for this user. Upload a pic for this user in the Azure portal</p>
                    }
                }
            </th>
            <th></th>
        </tr>
        @{
            var user = ViewData["me"] as Microsoft.Graph.Models.User;
            <tr>
                <th>
                    ID
                </th>
                <th>
                    @user.Id
                </th>
                <th></th>
            </tr>
            <tr>
                <th>
                    Display Name
                </th>
                <th>
                    @user.DisplayName
                </th>
                <th></th>
            </tr>
            <tr>
                <th>
                    Mail
                </th>
                <th>
                    @user.Mail
                </th>
                <th></th>
            </tr>
            <tr>
                <th>
                    UserPrincipalName
                </th>
                <th>
                    @user.UserPrincipalName
                </th>
                <th></th>
            </tr>
        }
    </thead>
    <tbody>
    </tbody>
</table>